using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;
using SharksHunter.TransferObjects.Model;
using System.IO;

namespace SharksHunter.Engine.Components
{
    public class PrepareIncomingFiles : Abstract.HunterComponent
    {
        
        List<SharksHunter.TransferObjects.Model.HuntInfo> _huntInfoList;
        

        public PrepareIncomingFiles(List<SharksHunter.TransferObjects.Model.HuntInfo> hi):base()
        {
            _huntInfoList = hi;
        }


        #region Thread
        override protected void ProcessOperations()
        {
            foreach(SharksHunter.TransferObjects.Model.HuntInfo info in this._huntInfoList)
            {
                foreach(string p in info.IncomingFolders)
                {
                    IO.FileSystemEnumerator fe = new IO.FileSystemEnumerator(p, "*.*", true);
                    foreach(FileInfo fi in fe.Matches())
                    {
                        HunterFileInfo efi = new HunterFileInfo(info.Entity, fi);
                        EnQueue(efi);
                    }
                }
            }
            this.SyncObject.SyncEvents.NoMoreJobEvent.Set();
        }
        #endregion

        #region override
        override protected object Process(object o)
        {
            return null;
        }
        #endregion
    }
}
